<?php
namespace Admin\Controller;

class UsersetController extends ComController
{
    public function index()
    {
        $list = D('Sysparams')->getByType(2);
        $this->assign('list', $list);
        $this->display();
    }

    // 保存设置
    public function saveset()
    {
       $data = I('post.'); 

       if (!isset($data['name'])) {
           return $this->ajaxReturn(array('status'=>0, 'msg'=> '参数错误'));
       }

       $res = D('Sysparams')->saveByKey($data['name'], $data['value']);

       if (!$res) {
           $info = array(
               'status' => 0,
               'msg' => '设置失败',
           );

           return $this->ajaxReturn($info);
       }

       addlog('编辑会员设置'.$id,'', $data);
       return $this->ajaxReturn(array('status'=>1, 'msg'=> '设置成功'));

    }
}
